#ifndef __PTGUI_CONTAINER_H__
#define __PTGUI_CONTAINER_H__

#include <ptgui/widgets/widget.h>

/** Gets the type of a container */
#define PTGUI_CONTAINER_TYPE	   (ptgui_container_type_get())
/** Casts the object to a ptgui_container */
#define PTGUI_CONTAINER(obj)	   (PTGUI_OBJECT_CAST((obj), PTGUI_CONTAINER_TYPE, ptgui_container_t))
/** Checks if the object is a ptgui_container */
#define PTGUI_IS_CONTAINER(obj)    (PTGUI_OBJECT_CHECK_TYPE((obj), PTGUI_CONTAINER_TYPE))

struct ptgui_container
{
	/* inherit from widget */
	struct ptgui_widget	parent;

	struct ptgui_widget	*focused;
	ptgui_list_t		children;
};
typedef struct ptgui_container ptgui_container_t;

ptgui_type_t *ptgui_container_type_get(void);

void ptgui_container_add_child(ptgui_container_t *container, ptgui_widget_t *child);
void ptgui_container_remove_child(ptgui_container_t *container, ptgui_widget_t *child);
void ptgui_container_destroy_children(ptgui_container_t *container);
ptgui_widget_t *ptgui_container_get_first_child(ptgui_container_t *container);

rt_bool_t ptgui_container_event_handler(ptgui_widget_t *widget, ptgui_event_t *event);

rt_bool_t ptgui_container_dispatch_event(ptgui_container_t *container, ptgui_event_t *event);
rt_bool_t ptgui_container_dispatch_mouse_event(ptgui_container_t *container, struct ptgui_event_mouse *event);

#endif
